package com.ly.share.juc.statistics;

import java.util.concurrent.atomic.LongAdder;

/**
 * @author icanci
 * @since 1.0 Created in 2022/06/06 21:26
 */
public class LongAdderDemo extends AbstractLockDemo {
    private static final LongAdder LONG_ADDER = new LongAdder();

    public static void main(String[] args) {
        LongAdderDemo lockDemo = new LongAdderDemo();
        Long sum = lockDemo.log(() -> {
            for (int i = 0; i < count; i++) {
                LONG_ADDER.increment();
            }
            return LONG_ADDER.longValue();
        });
        System.out.println(sum);
    }
}
